﻿using System.Collections.Generic;
using System.Web;
using System.Web.UI;

namespace Wedn.TemplateEngine.UC
{
    /// <summary>
    /// 母版页操作助手类
    /// </summary>
    public class MasterHelper
    {
        /// <summary>
        /// 模版变量
        /// </summary>
        private Master master;
        /// <summary>
        /// 构造函数
        /// </summary>
        public MasterHelper(Master master)
        {
            //this.page = (Page)HttpContext.Current.Handler;
            this.master = master;//(Master)((Page)HttpContext.Current.Handler).Master;
        }
        /// <summary>
        /// 增加一个标签
        /// </summary>
        /// <param name="key">键</param>
        /// <param name="obj">值</param>
        public void Put(string key, object obj)
        {
            master.SetDict(new KeyValuePair<string, object>(key, obj));
        }
        /// <summary>
        /// 批量加载数据
        /// </summary>
        /// <param name="dict">批量数据字典</param>
        public void Set(Dictionary<string, object> dict)
        {
            if (dict == null)
                return;
            //template.Data.Clear();
            master.SetDict(dict);
        }
    }
}